package com.jiaeda.shiromaster.mapper;

import com.jiaeda.shiromaster.entity.SysPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by chengchaopeng on 2018/6/27.
 */
@Mapper
@Component
public interface SysPermissionMapper {




    @Select("<script>select id,data_url as dataUrl,menu_class as menuClass,menu_code as menuCode,menu_name as menuName," +
            " parent_menucode as parentMenucode,sequence,menu_type as menuType," +
            " DATE_FORMAT(create_time, '%Y-%m-%d %T') as createTime  from sys_permission " +
            "WHERE" +
            "<if test=\"permissionIds!=null\">" +
            " id in " +
            "<foreach collection='permissionIds' index='index' item='item' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</if></script>")
    List<SysPermission> findByPermissionIds(@Param("permissionIds") String[] permissionIds);

}
